<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //手机
        function Phone(brand, price) {
            this.brand = brand;
            this.price = price;
        }
        Phone.prototype.call = function() {
            console.log('我可以打电话！！');
        }
        let huawei = new Phone('华为', 5999);
        huawei.call();
        console.log(huawei);
        //class
        class Phone1 {
            //构造方法 名字不能修改
            constructor(brand, price) {
                this.brand = brand;
                this.price = price;
            }
            call() {
                console.log('我可以打电话')
            }
        }
        let onePlus = new Phone1('1+', 1999);
        console.log(onePlus);
    </script>
</body>

</html>